/**
Dom4j根据路径解析Xml

<?xml version="1.0" encoding="GBK"?>

<config>
    <xmlconfig>
        <className>com.szkingdom.kfit.bank.tfb8.util.Tfb8Config</className>
        <className>com.szkingdom.kfit.bank.cmbc.helper.CMBC</className>
    </xmlconfig>
</config>

*/
public class Dom4jByPath{
	
	private class XmlUtil{
		public void test(){
			System.out.println("Hello World!!!");
		}

		public Document read(String path) throws DocumentException {
			SAXReader reader = new SAXReader();
            InputStreamReader is = new InputStreamReader(new XMLUtil().getClass().getResourceAsStream(path), java.nio.charset.Charset.forName("GBK"));
            Document document = reader.read(is);
            return document;
		}
	}
	
	public static void main(String[] args){
		Dom4jByPath d = new Dom4jByPath();
		Dom4jByPath.XmlUtil c =  d.new XmlUtil();
		c.test();
		System.out.println("----------------------");
		
		Document document = null;
        try {
            document =  c.read("/classConfig.xml");
            System.out.println(document);
        } catch (DocumentException e) {
            e.printStackTrace();
        }
		//获取配置文件
        List xmlConfigList = document.selectNodes("//config/xmlconfig/className");
        
		for (int i = 0; i < xmlConfigList.size(); i++) {
            Element element = (Element) xmlConfigList.get(i);
            System.out.println(element.getText().trim());
        }		
	}
}
